Docker2 安装

安装ssh

1
sudo apt-get install openssh-server

查看是否启动

1
sudo ps -e |grep ssh

启动

1
sudo service ssh start

允许管理员使用密码登录
配置文件中的”PermitRootLogin without-password”加一个”#”号,把它注释掉再增加一句”PermitRootLogin yes”

查看内核版本

1
2
rexyan@ubuntu:~$ uname -a
Linux ubuntu 4.4.0-116-generic #140-Ubuntu SMP Mon Feb 12 21:22:43 UTC 2018 i686 i686 i686 GNU/Linux

内核应该高于3.10,这里是4.4.0

更新ubuntu软件源为阿里

1
sudo vim /etc/apt/sources.list

替换为

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# deb cdrom:[Ubuntu 16.04 LTS _Xenial Xerus_ - Release amd64 (20160420.1)]/ xenial main restricted
deb-src http://archive.ubuntu.com/ubuntu xenial main restricted #Added by software-properties
deb http://mirrors.aliyun.com/ubuntu/ xenial main restricted
deb-src http://mirrors.aliyun.com/ubuntu/ xenial main restricted multiverse universe #Added by software-properties
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted multiverse universe #Added by software-properties
deb http://mirrors.aliyun.com/ubuntu/ xenial universe
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates universe
deb http://mirrors.aliyun.com/ubuntu/ xenial multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse #Added by software-properties
deb http://archive.canonical.com/ubuntu xenial partner
deb-src http://archive.canonical.com/ubuntu xenial partner
deb http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted multiverse universe #Added by software-properties
deb http://mirrors.aliyun.com/ubuntu/ xenial-security universe
deb http://mirrors.aliyun.com/ubuntu/ xenial-security multiverse

执行update

1
sudo apt-get update

安装Docker

1
sudo apt install docker

启动

1
sudo service docker start

若为普通用户,可将该用户加入自动创建docker组

1
sudo usermod -aG docker rexyan  # 例如将rexyan加入到docker组中

查看Docker版本信息【若docker服务没有启动,则看不见server端的信息】

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
rexyan@ubuntu:~$ docker version
Client:
Version: 1.13.1
API version: 1.26
Go version: go1.6.2
Git commit: 092cba3
Built: Thu Nov 2 20:40:26 2017
OS/Arch: linux/386

Server:
Version: 1.13.1
API version: 1.26 (minimum version 1.12)
Go version: go1.6.2
Git commit: 092cba3
Built: Thu Nov 2 20:40:26 2017
OS/Arch: linux/386
Experimental: false